package cn.structure.edp;

import cn.structure.ClassEntity;
import cn.structure.MethodEntity;

import java.util.Objects;

public class Conglomeration extends EdpEntity {
    private ClassEntity conglomerator;
    private MethodEntity operation;
    private MethodEntity operation2;

    public Conglomeration(ClassEntity conglomerator, MethodEntity operation, MethodEntity operation2) {
        super();
        this.conglomerator = conglomerator;
        this.operation = operation;
        this.operation2 = operation2;
    }

    public enum Role {
        conglomerator, operation, operation2
    }

    public ClassEntity getConglomerator() {
        return conglomerator;
    }

    public void setConglomerator(ClassEntity conglomerator) {
        this.conglomerator = conglomerator;
    }

    public MethodEntity getOperation() {
        return operation;
    }

    public void setOperation(MethodEntity operation) {
        this.operation = operation;
    }

    public MethodEntity getOperation2() {
        return operation2;
    }

    public void setOperation2(MethodEntity operation2) {
        this.operation2 = operation2;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Conglomeration{\n\t");
        sb.append(super.toString());
        sb.append("\n\t\"conglomerator\":")
                .append(conglomerator);
        sb.append(",\n\t\"operation\":")
                .append(operation);
        sb.append(",\n\t\"operation2\":")
                .append(operation2);
        sb.append("\n}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        Conglomeration that = (Conglomeration) o;
        return Objects.equals(conglomerator, that.conglomerator) &&
                Objects.equals(operation, that.operation) &&
                Objects.equals(operation2, that.operation2);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), conglomerator, operation, operation2);
    }
}
